package com.simon.dao;

import android.content.Context;

import com.j256.ormlite.android.apptools.OpenHelperManager;

public class DatabaseManager {

	private NoteDaoHelper databaseHelper = null;

	// gets a helper once one is created ensures it doesnt create a new one
	public NoteDaoHelper getHelper(Context context) {
		if (databaseHelper == null) {
			databaseHelper = OpenHelperManager.getHelper(context,
					NoteDaoHelper.class);
		}
		return databaseHelper;
	}

	// releases the helper once usages has ended
	public void releaseHelper(NoteDaoHelper helper) {
		if (databaseHelper != null) {
			OpenHelperManager.releaseHelper();
			databaseHelper = null;
		}
	}

}
